/**
 *  message mapping, configure message here
 * */
var model = require("../../model");

var map = {
    sql: model,

    error: {
        401: '无访问权限',
        402: '未登录,请先登录',
        405: '用户名有误',
        406: '密码错误',

        501: '无法取得数据库连接',
        502: '数据库查询出错',
        503: '请求参数有误',
        504: "无法更改管理员信息",
        505: "无任何需要导入的数据",
        506: "文件中含有不合要求的行",
        507: "文件中或与数据库中有重复的项目名称,如需恢复已删除数据请联系数据库管理员"
    },

    projectStatus: {
        established: "立项准备",
        research: "预研阶段",
        requirement: "需求阶段",
        develop: "开发阶段",
        testing: "构建与测试",
        handout: "交付阶段",
        deploy: "实施阶段",
        maintain: "维护定制",
        cancel: "项目终止",
        finish: "已结项"
    },
    statusKey: [
        {id: "established", value: "立项准备"},
        {id: "research", value: "预研阶段"},
        {id: "requirement", value: "需求阶段"},
        {id: "develop", value: "开发阶段"},
        {id: "testing", value: "构建与测试"},
        {id: "handout", value: "交付阶段"},
        {id: "deploy", value: "实施阶段"},
        {id: "maintain", value: "维护定制"},
        {id: "cancel", value: "项目终止"},
        {id: "finish", value: "已结项"}
    ],

    role: {
        "admin": "管理员",
        "manager": "研发组长",
        "member": "组员",
        "intern": "实习生"
    },
    roleKey: [
        {id: "manager", value: "研发组长"},
        {id: "member", value: "组员"},
        {id: "intern", value: "实习生"}
    ],

    extraType: [
        {id: "risk", value: "研发风险问题及措施"},
        {id: "change", value: "人员变动及其他信息"},
        {id: "training", value: "人员成长情况培养计划"}
    ],

    navigation: {
        admin: {
            '账号管理': '/member/find',
            '项目管理': '/project/find',
            '计划安排': '/plan/list',
            '研发组管理': '/team/find'
        },
        manager: {
            '项目管理': '/project/find',
            '计划安排': '/plan/list'
        },
        member: {
            '查看项目': '/project/find',
            '计划安排': '/plan/list'
        },
        intern: {
            '查看项目': '/project/find',
            '计划安排': '/plan/list'
        }
    },

    generateNavBar: function (req) {
        var obj = {};
        obj.nav = map.navigation[map.userRole[req.session.uid]];
        obj.user = {
            name: map.userName[req.session.uid],
            role: map.userRole[req.session.uid]
        };
        return obj;
    }
};

exports.Map = map;